﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="group.aspx.cs" Inherits="EnmineKaitlin.admin.group" MasterPageFile="~/MasterPage/AdminDefault.Master" %>
<%@ Register Assembly="EnmineKaitlin" Namespace="EnmineKaitlin.Common" TagPrefix="Pagging" %>
<asp:Content ID="ctnGroup" ContentPlaceHolderID="cphContent" runat="server">
<div class="form list">
        <h2><span class="icon"><img src="../images/admin/Play.png"></span>Nhóm người dùng</h2>
        <div class="content">
            <div class="left add-user">
                <asp:Panel ID="pnlAddGroup" runat="server">
                <h3>Thêm nhóm người dùng</h3>
                <table border="0">
                    <tr>
                        <td align="right">Tên nhóm:</td>
                        <td><asp:TextBox ID="txtName" Width="180" runat="server" CssClass="txt required"></asp:TextBox></td>
                    </tr>
                    <tr><td align="right">Mô tả:</td><td><asp:TextBox ID="txtDescription" Width="180" TextMode="MultiLine" runat="server" CssClass="txt required"></asp:TextBox></td></tr>                    
                    <tr><td>Phân quyền:</td><td><asp:CheckBoxList ID="cblPermission" runat="server">
                        <asp:ListItem Text="Quản trị bài viết, trang" Value="manage-post"></asp:ListItem>
                        <asp:ListItem Text="Quản trị thăm dò ý kiến" Value="manage-poll"></asp:ListItem>
                        <asp:ListItem Text="Quản trị hỏi đáp" Value="manage-faq"></asp:ListItem>
                        <asp:ListItem Text="Quản trị người dùng" Value="manage-user"></asp:ListItem>
                    </asp:CheckBoxList></td></tr>
                    <tr><td></td><td><asp:Button ID="btnAddGroup" runat="server" Text="Thêm người dùng" CssClass="btn right" OnClick="btnAddGroup_Click" /></td></tr>                                                                                    
                </table>
                </asp:Panel>
                <asp:Panel ID="pnlDetailGroup" runat="server" Visible="false">
                    <h3>Cập nhật nhóm người dùng</h3>
                    <asp:Repeater ID="rptDetailGroup" runat="server" OnItemCommand="rptDetailGroup_Update">
                        <HeaderTemplate><table border="0"></HeaderTemplate>
                        <ItemTemplate>                            
                                <tr>
                                    <td align="right">Tên nhóm:</td>
                                    <td><asp:TextBox ID="txtName" Width="180" runat="server" Text='<%#Eval("Name") %>' CssClass="txt required"></asp:TextBox></td>
                                </tr>
                                <tr><td align="right">Mô tả:</td><td><asp:TextBox ID="txtDescription" Width="180" Height="80" Text='<%#Eval("Description") %>' TextMode="MultiLine" runat="server" CssClass="txt required"></asp:TextBox></td></tr>
                                <tr><td>Phân quyền:</td><td><asp:CheckBoxList ID="cblPermission" runat="server">
                                    <asp:ListItem Text="Quản trị bài viết, trang" Value="manage-post"></asp:ListItem>
                                    <asp:ListItem Text="Quản trị thăm dò ý kiến" Value="manage-poll"></asp:ListItem>
                                    <asp:ListItem Text="Quản trị hỏi đáp" Value="manage-faq"></asp:ListItem>
                                    <asp:ListItem Text="Quản trị người dùng" Value="manage-user"></asp:ListItem>
                                </asp:CheckBoxList></td></tr>
                                <tr><td></td><td><asp:Button ID="btnUpdateUser" runat="server" Text="Cập nhật" CssClass="btn right" CommandName="Update" CommandArgument='<%#Eval("GroupID") %>' /></td></tr>                                                                                            
                        </ItemTemplate>
                        <FooterTemplate></table></FooterTemplate>
                    </asp:Repeater>
                </asp:Panel>
            </div>
            <div class="list-cat-right">
                <asp:Label ID="lblNotice" runat="server" CssClass="error"></asp:Label>                                                    
                <asp:GridView ID="grvGroup" runat="server" AutoGenerateColumns="false" 
                    DataKeyNames="GroupID" Width="100%" 
                    CssClass="tbl-list" AlternatingRowStyle-BackColor="AntiqueWhite" OnRowDataBound="grvGroup_RowDataBound" 
                    OnRowCommand="grvGroup_RowCommand" onrowdeleting="grvGroup_RowDeleting">
                    <Columns>                        
                        <asp:TemplateField HeaderText="STT" >
                            <ItemTemplate><%#Container.DataItemIndex+1 %></ItemTemplate>
                        </asp:TemplateField>    
                        <asp:BoundField HeaderText="Tên nhóm" DataField="Name" />                    
                        <asp:BoundField HeaderText="Mô tả" DataField="Description" />                        
                        <asp:TemplateField HeaderText="Thao tác" ItemStyle-Width="60">
                            <ItemTemplate>
                                <a href='/admin/group.aspx?gid=<%#Eval("GroupID") %>' class="btnEdit">Sửa</a>
                                <asp:LinkButton ID="lbtDelete" runat="server" CssClass="btnDelete" Text="Xóa" CommandName="delete" CommandArgument='<%#Eval("GroupID") %>'></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>  
                <div class="pagenav">                    
                    <Pagging:PaggingControl runat="server" ID="ctlPagging" Mode="Url" PageSize="20"
                    PreviousClause="<img src='../images/Back.png'/>" NextClause="<img src='../images/Forward.png'/>" />
                </div>              
            </div>
        </div>
    </div>
</asp:Content>